import { ETaskState } from "GameLoop/DecisionMaking/TaskDeclare/type";
import { ATaskAdapter } from ".";
 

export class CoreTaskAdapter extends ATaskAdapter<"core">
{
    // constructor(context:IContextGetter,world:WorldGetter)
    // {
    //     super(context,world);
       
    // }
 
    public bindTasks(room: Room, tasks:ITaskDeclare["core"][],customCheck:IConditionFunction): void 
    {
        for(const task of tasks)
        {
            if(customCheck(room as Required<Room>,task) == OK )
            {
                room.deleteTaskById(task.id,"core");
               
            }
            else if(ETaskState.Complete == this.checkState(room,task))
            {
                //global.Log.Info(`${room.name} room ${task.id} check 已经完成`);
                room.deleteTaskById(task.id,"core");
                
            }
           // global.Log.Info(`${room.name} room ${task.id} check 未完成`);
           break;
        }
    }

    protected checkState(room:Room,task:ITaskDeclare["core"]):ETaskState
    {
        
        return  ETaskState.Running;
    }
    
}